<script lang="ts">
import { defineComponent } from "vue";
import $config from "./common/config";
import { connectWebsocket, setConfig, beforeRouterInvoke } from "./common/libs/dependency";

export default defineComponent<{ globalData: typeof $config }>({
  globalData: { $config },
  onLaunch(e: any) {
    console.log(e);
    
    e?.path && beforeRouterInvoke(e.path);
    // uni.setLocale("zh");
    connectWebsocket();
    setConfig();
  },
  onPageNotFound({ path }: App.PageNotFoundOption) {
    console.log(path);

    path !== "/" && uni.redirectTo({ url: this.globalData.$config.PAGE_NOT_FOUND });
  },
  onThemeChange({ theme }: { theme: "light" | "dark" }) {
    plus.nativeUI.setUIStyle(theme);
    this.$store.commit("setState", { key: "theme", value: theme });
  },
});
</script>

<style lang="scss">
@import "@/common/style/reset.scss";
@import "@/common/style/common.scss";
@import "@/common/style/theme.scss";
</style>
